home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / msdos / lynx / source / doslynx / src / tdiskvi2.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-25  |  1.3 KB  |  44 lines

  1. //    Copyright (c) 1994, University of Kansas, All Rights Reserved
  2. //
  3. //    Class:        TDiskView
  4. //    Include File:    tdiskvie.h
  5. //    Purpose:    Provide a view of free temporary disk space.
  6. //    Remarks/Portability/Dependencies/Restrictions:
  7. //    Revision History:
  8. //        02-18-94    created
  9. #include"tdiskvie.h"
  10. #include"globals.h"
  11. #include<dos.h>
  12. #include<dir.h>
  13. #include<ctype.h>
  14.  
  15. unsigned long int TDiskView::GetDiskFree()    {
  16. //    Purpose:    Determine the amount of free disk space in the
  17. //            temporary directory.
  18. //    Arguments:    void
  19. //    Return Value:    unsigned long int    The amount of free space.
  20. //    Remarks/Portability/Dependencies/Restrictions:
  21. //        Creates a temporary file name and splits it to find out
  22. //        exactly where the directory to size is.
  23. //    Revision History:
  24. //        02-18-94
  25.  
  26.     //    Create the temporary file name.
  27.     TTempName TTN(::cp_TempDir);
  28.  
  29.     //    Determine the drive from the temporary file name.
  30.     char ca_drive[MAXDRIVE];
  31.     int i_drive = 0;
  32.     int i_fns = fnsplit(TTN.getName(), ca_drive, NULL, NULL, NULL);
  33.     if(i_fns & DRIVE)    {
  34.         i_drive = toupper(ca_drive[0]) - 'A' + 1;
  35.     }
  36.  
  37.     //    Obtain the amount of free disk space.
  38.     struct dfree df_info;
  39.     getdfree(i_drive, &df_info);
  40.  
  41.     //    Return the information.
  42.     return((unsigned long int)df_info.df_avail * (unsigned long int)
  43.         df_info.df_bsec * (unsigned long int)df_info.df_sclus);
  44. }